package com.yundasys.lab02springbootstudy.controller;

import com.yundasys.lab02springbootstudy.service.CalculateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jiangta
 * @version 1.0
 * @date 2021/1/21 10:27 上午
 */
@RestController
public class CalculateController {

    @Autowired
    CalculateService calculateService;

    @RequestMapping("/add/{a}/{b}")
    public String add(@PathVariable("a") int a, @PathVariable("b") int b){

        int add = calculateService.add(a, b);

        return "add result: "
                + add + calculateService.getServiceDesc();
    }
}
